package routers

import (
	"car-table/handlers"
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
)

func Init() *gin.Engine {
	r := gin.Default()
	r.Use(cors.Default())
	r.Static("static", "./static")
	//user
	r.POST("/user/login", handlers.UserLogin)
	r.POST("/user/roleAddNode", handlers.RoleAddNode)
	r.GET("/user/userRole", handlers.UserRole)
	r.GET("/user/RoleNode", handlers.RoleNode)

	//car
	r.POST("/car/Add", handlers.Add)
	r.POST("/car/orderAdd", handlers.OrderAdd)
	r.GET("car/orderList", handlers.OrderList)
	r.GET("car/OrderDetail", handlers.OrderDetail)
	return r
}
